package service.impl;

import dao.RoomDao;
import pojo.Room;
import service.RoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomServiceImpl implements RoomService {

    @Autowired
    private RoomDao roomDao;

    @Override
    public int addRoom(Room room) {
        return roomDao.insert(room);
    }

    @Override
    public int updateRoom(Room room) {
        return roomDao.update(room);
    }

    @Override
    public int deleteRoom(Integer roomId) {
        return roomDao.delete(roomId);
    }

    @Override
    public Room getRoomById(Integer roomId) {
        return roomDao.selectById(roomId);
    }

    @Override
    public List<Room> getAllRooms() {
        return roomDao.selectAll();
    }

    @Override
    public List<Room> getRoomsByFloor(Integer floor) {
        return roomDao.selectByFloor(floor);
    }

    @Override
    public List<Room> getRoomsByDepartId1(Integer departId1) {
        return roomDao.selectByDepartId1(departId1);
    }
}